<template>
  <div/>
</template>

<script>
import {
  oauthLogin
} from '@/api/admin/auth/wechat/wechatAuthentication'

export default {
  name: 'Oauth',
  data() {
    return {
      title: '授权页面'
    }
  },
  mounted() {
    // 带文案，显示透明遮罩层（默认），自动消失
    this.$toast.loading('微信授权中...', {
      duration: 3000
    })
    this.getUserId()
  },
  methods: {
    getUserId() {
      oauthLogin({ hostUrl: window.location.href.split(':')[0] + '://' + location.host,
        agentId: this.$route.query.agentId,
        pageUrl: this.$route.query.pageUrl }).then(res => {
        window.location.href = res
      })
    }
  }
}
</script>
